Ext.namespace("Info.Main");

Info.Main.panel = function(infoType) {
	this.connUserType = new Ext.data.Connection({
		url:'../info/getUserType.form?timesnap=' + Date.parse(new Date()),
		method:'post'
	});
	
	this.tabPanel = new Ext.TabPanel({
		region:'center'
	});
	
	if(!Info.Prepare.panel.instance)
		Info.Prepare.panel.instance = new Info.Prepare.panel();
	this.tabPanel.add(Info.Prepare.panel.instance);
	this.tabPanel.activate(Info.Prepare.panel.instance);
	if(!Info.Complete.panel.instance)
		Info.Complete.panel.instance = new Info.Complete.panel();
	this.tabPanel.add(Info.Complete.panel.instance);

	Info.Main.panel.superclass.constructor.call(this, {
		layout:'border',
		items:[this.tabPanel]
	});
	
	this.getUserType();
};
Ext.extend(Info.Main.panel, Ext.Viewport, {
	getUserType:function(){
		Utils.request(this.connUserType,{
			scope:this,
			success:function(resp, action){
				if(resp && resp.userType === 'manager'){
					this.scope.tabPanel.add(new Info.Stat.panel());
				}
			}
		});
	}
});

Ext.onReady(function() {
    Ext.QuickTips.init();
    Ext.form.Field.prototype.msgTarget = 'side';
    Ext.BLANK_IMAGE_URL = '../resources/images/default/s.gif';

    new Info.Main.panel();
});

